<?php
/**
* Class and Function List:
* Function list:
* - set()
* - get()
* - getNumber()
* - getIntNumber()
* - setBackLink()
* - getBackLink()
*/
class Session
{
    function set($varname, $value = '')
    {
        if (strlen($varname) > 0) $_SESSION[$varname] = $value;
    }
    function setCfer($varname, $value)
    {
        if (sizeof($varname) > 0) $_SESSION[$varname] = $value;
    }
    function get($varname,$default='')
    {
        return isset($_SESSION[$varname]) ? $_SESSION[$varname] : $default;
    }
    function getCfer($varname)
    {
        return isset($_SESSION[$varname]) ? $_SESSION[$varname] : array(_LB_ACCUEIL => Utils::getHomeLink());
    }
    function getNumber($varname)
    {
        $str_value = Session::get($varname);
        return is_numeric($str_value) ? $str_value : 0;
    }
    function getIntNumber($varname)
    {
        return intval(Session::getNumber($varname));
    }
    function setBackLink($object_name)
    {
        //Session::set($object_name . '_back_link', $_SERVER['REQUEST_URI']);
        Session::set($object_name . '_back_link', DRX::load("decoded_requesturl"));
    }
    function clearBackLink($object_name)
    {
        Session::set($object_name . '_back_link', '');
    }
    function getBackLink($object_name,$default='')
    {
        return Session::get($object_name . '_back_link',$default);
    }
    function setBackCfer($object_name, $cfer)
    {
        Session::setCfer($object_name . '_back_cfer', $cfer);
    }
    function clearBackCfer($object_name)
    {
        Session::setCfer($object_name . '_back_cfer', array(_LB_ACCUEIL => Utils::getHomeLink()));
    }
    function getBackCfer($object_name)
    {
        return Session::getCfer($object_name . '_back_cfer');
    }

}
?>
